package com.example.observable;

import java.util.Observable;

public class ObservableDemo extends Observable {

    public static void main(String[] args) {
        ObservableDemo observableDemo=new ObservableDemo();
        observableDemo.addObserver((observable,obj)->{
            System.out.println("数据发生变化a");
        });
        observableDemo.addObserver((observable,obj)->{
            System.out.println("数据发生变化b");
        });
        observableDemo.setChanged();
        observableDemo.notifyObservers();
    }
}
